/**
 * Copyright (C) 2017 - 2020 https://github.com/joewee
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.bifrost.service;

import com.bifrost.entity.CountryArea;
import com.bifrost.entity.MerchantStore;
import com.bifrost.entity.Order;
import com.bifrost.exception.PricingException;
import com.bifrost.exception.UnsupportedShippingTypeException;
import com.bifrost.model.OrderRequest;

import java.math.BigDecimal;
import java.util.List;

/**
 * @author joewee
 * @version 1.0.0
 * @Date 2017/11/22 17:31
 */
public interface ShippingService {
    boolean canDelivery(OrderRequest request);

    /**
     * 按照单品运费模式计算商品单品邮费
     *
     * @param order
     * @return
     */
    BigDecimal shippingPricingBySkuTemplate(Order order, CountryArea district) throws PricingException;

    /**
     * 按照店铺运费模式计算邮费
     *
     * @param store
     * @param order
     * @return
     */
    BigDecimal shippingPricingByStoreTemplate(MerchantStore store, Order order) throws PricingException;

    /**
     * 混合模式下计算邮费
     *
     * @param order
     * @param deliveryDistrict
     * @return
     */
    BigDecimal shippingPricingByMixedTemplate(Order order, CountryArea deliveryDistrict) throws PricingException;

    /**
     * 寻找最合适的快递方式
     *
     * @param shippingTypes
     * @return
     */
    String findBestShippingType(List<String> shippingTypes) throws UnsupportedShippingTypeException;
}
